package com.xes.ams.client.api;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

public class Result<T extends Object> {
	/***
	 * 操作 是否成功
	 */
	private boolean success;
	/***
	 * 响应码
	 */
	private int code;
	/***
	 * 返回消息
	 */
	private String message; 
	/***
	 * 返回附加信息 可以是String、List、JSON、Map 类型
	 */
	private T data;

	
	public Result() {
		super();
	}


	public Result(boolean success, int code, String message) {
		super();
		this.success = success;
		this.code = code;
		this.message = message;
	}


	public Result(boolean success, String message) {
		super();
		this.success = success;
		this.message = message;
	}


	public Result(boolean success, String message, T data) {
		super();
		this.success = success;
		this.message = message;
		this.data = data;
	}
	
	public Result(boolean success, int code, String message, T data) {
		super();
		this.success = success;
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public int getCode() {
		return code;
	}


	public void setCode(int code) {
		this.code = code;
	}


	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE);
	}
	
}
